package yuan.deng.controller;

import org.junit.Test;
import yuan.deng.domain.Student;
import yuan.deng.service.StudentService;
import yuan.deng.service.StudentServiceImpl;

import java.util.List;

public class StudentController {
    //使用业务层，创建service层对象
    StudentService service=new StudentServiceImpl();
    //查询表中所有信息（用传统的方法）
    @Test
    public void findAll(){
        List<Student> list = service.findAll();
        System.out.println(list);
    }
    //增加表中数据
    @Test
    public void add(){
        Student st=new Student(6,"xiaoming",34);
        int i = service.add(st);
        System.out.println(i);
    }
    //模糊查询，按姓名
    @Test
    public void  findLike(){
        List<Student> list = service.findLike("李");
        System.out.println(list);
    }
    //按id删除数据
    @Test
    public void  del(){
        int i = service.del(3);
        System.out.println(i);
    }
}
